home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / AIAT 1.0.1 / Headers / Index / TFVector.h < prev    next >
Encoding:
Text File  |  1997-09-11  |  1.5 KB  |  58 lines  |  [TEXT/CWIE]

  1. // TFVector.h
  2. //    Copyright:    © 1994 - 1996 by Apple Computer, Inc., all rights reserved.
  3.  
  4. #pragma once
  5. #ifndef TFVector_h
  6. #define TFVector_h
  7.  
  8. #pragma import on
  9.  
  10. #include "TermIndex.h"
  11.  
  12. #pragma IA_BEGIN_EXPORTS
  13.  
  14. // TFComponent: what TFVector's are made of.
  15. struct TFComponent {
  16.     TermID            termID;                // the TermID
  17.     TermFreq        freq;                // the frequency of that term
  18. private:
  19.     void*            operator new(size_t size);    // stack or array allocate only
  20. };
  21.  
  22. // order function so that arrays of TFComponent can be sorted by qsort
  23. extern "C" { int TFComponentOrder(const void* c1, const void* c2); }
  24.  
  25. // TFVector: available from a VectorIndex.
  26. class TFVector : public IAObject {
  27.     friend class    VectorIndex;
  28. public:
  29.                     TFVector(DocLength l);
  30.                     ~TFVector();
  31.  
  32.     bool Validate(bool verbose);
  33.     void    SetDocumentLength(DocLength len) {length = len;}
  34.     DocLength GetDocumentLength()  const {return length;}
  35.     
  36.     void    SetComponents(TFComponent* comps) {components = comps;}
  37.     TFComponent*    GetComponents() const {return components;}
  38. private:    
  39.     IABlockSize        ComponentsSize();
  40.     void            ComponentsWrite(IAOutputBlock* output);
  41.     void            ComponentsRead(IAInputBlock* input);
  42.  
  43.                     TFVector(TFVector&);            // don't define a copy constructor
  44.                     
  45.     DocLength        length;                    // the number of components in the vector
  46.     TFComponent*    components;                // an array of TFComponents, sorted by termID
  47.  
  48. };
  49.  
  50. // returns a new TFVector which is the sum of the argument vectors
  51. //TFVector*        SumTFVectors(TFVector** vectors, uint32 nVectors);
  52.  
  53. #pragma IA_END_EXPORTS
  54.  
  55. #pragma import reset
  56.  
  57. #endif
  58.